import type {
  PlatformElementConfig,
  StyleConfigMap,
  VideoFrameworkConfig,
} from '../../interfaces'
import { preprocessElementConfigs } from '../personalization'
import { COMMON_PAGE_ELEMENTS } from './common'

/**
 * 页面元素配置
 */
export const BILIBILI_VIDEO_PAGE_ELEMENTS: Record<string, PlatformElementConfig> = {
  ...COMMON_PAGE_ELEMENTS,
}
// 预处理配置
const PROCESSED_BILIBILI_VIDEO_ELEMENTS = preprocessElementConfigs(BILIBILI_VIDEO_PAGE_ELEMENTS)

export type BilibiliVideoElements = typeof BILIBILI_VIDEO_PAGE_ELEMENTS
export type BilibiliVideoElementKey = keyof typeof BILIBILI_VIDEO_PAGE_ELEMENTS
export type BilibiliVideoElementValue = typeof BILIBILI_VIDEO_PAGE_ELEMENTS[BilibiliVideoElementKey]

/**
 * 框架配置类型
 */
export type BilibiliVideoFrameworkConfig = {
  [K in keyof VideoFrameworkConfig]: Partial<StyleConfigMap>
}

/**
 * 框架配置
 */
export const BILIBILI_VIDEO_FRAMEWORK_CONFIG: BilibiliVideoFrameworkConfig = {
  GLOBAL: {
    elementHide: [
      PROCESSED_BILIBILI_VIDEO_ELEMENTS.PAGE_ELEMENTS,
    ],
  },
  PLAYER: {
  },
}
